import request from "./useRequests";
import { userinfo } from '@/stores/counter'
import { ElMessage } from 'element-plus'

export default function getDiscussionCate() {
    const user = userinfo()
    async function getDiscussionCateList() {
        if (user.discussionCates.length > 0) {
            return user.discussionCates
        }
        try {
            const res = await request({
                method: "get",
                url: `/news/getDiscussionCate`,
            })
            return res.data.data.list

        } catch (err: any) {
            //alert(err)
        }
    }

    return {
        getDiscussionCateList
    }
}